package com.chaoyue.learning.contorller;


import com.chaoyue.base.model.PageResult;
import com.chaoyue.learning.beans.dto.CyChooseCourseDto;
import com.chaoyue.learning.beans.dto.CyCourseTablesDto;
import com.chaoyue.learning.beans.dto.MyCourseTableParams;
import com.chaoyue.learning.beans.po.CyCourseTables;
import com.chaoyue.learning.service.MyCourseTablesService;
import com.chaoyue.learning.util.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author whr
 * @version 1.0
 * @description: 我的课程接口
 * @date 2023/5/30 19:48
 */
@SuppressWarnings({"all"})
@Api(value = "我的课程表接口", tags = "我的课程表接口")
@Slf4j
@RestController
public class MyCourseTablesController {
    @Autowired
    MyCourseTablesService myCourseTablesService;

    @ApiOperation("添加选课")
    @PostMapping("/choosecourse/{courseId}")
    public CyChooseCourseDto addChooseCourse(@PathVariable("courseId") Long courseId) {
      //  SecurityUtil.XcUser user = SecurityUtil.getUser();
        return myCourseTablesService.addChooseCourse("51", courseId);
    }

    @ApiOperation("查询学习资格")
    @PostMapping("/choosecourse/learnstatus/{courseId}")
    public CyCourseTablesDto getLearnstatus(@PathVariable("courseId") Long courseId) {
        SecurityUtil.XcUser user = SecurityUtil.getUser();
        return myCourseTablesService.getLearningStatus(user.getId(), courseId);
    }

    @ApiOperation("我的课程表")
    @GetMapping("/mycoursetable")
    public PageResult<CyCourseTables> mycoursetable(MyCourseTableParams params) {
        return null;
    }

}
